export default function myExample () {
  return {
    name: 'my-example',
    // enforce: 'pre'(核心插件之前) | 'post' // 插件执行时间
    options (opts) {
      console.log('options', opts);
    }, 
    buildStart () {
      console.log('buildStart');
    },
    config (config) {
      console.log('config',config);
      return {}
    },
    configResolved (resolvedConfig) {
      console.log('resolvedConfig');
    },
    configureServer (server) {
      console.log();
      // server.app.use((req, res, next) => {
      //   // custom handle request ...
      // })
    },
    transformIndexHtml (html) {
      console.log('transformIndexHtml');
      return html
      // return html.replace(
      //   /<title>(.*?)<\/title>/,
      //   `<title>Title replaced !</title>`
      // )
    },
    resolveId (source) {
      if (source === 'virtual-module') {
        return source
      }
      return null
    },
    load (id) {
      if (id === 'virtual-module') {
        return 'export default "This is virtual!"'
      }
      return null;
    }
  }
}